<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标事件</title>
    <script>
        function $(id){
            return document.getElementById(id);
        }
        window.onload=function (){
            let  picture = $("moveImg");
            document.onmousemove=function (e){//e表示事件对象，记录了时间发生时的信息
                // console.log("杨杨"+e.clientX+"   "+e.clientY);

                picture.style.left=e.clientX+"px";
                picture.style.top=e.clientY+"px";
            }
            document.onmouseover=function (){
                picture.style.display="block";
            }
            document.onmouseout=function (){
                picture.style.display="none";
            }
        }
    </script>
</head>
<body>
<img src="youjiantou.png" alt="" style="position: absolute;display: none" id="moveImg">
</body>
</html>